package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.proxy.RpcClientProxy;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @Classname UserController
 * @Date 2021/5/4 15:44
 * @Author ch'ien
 */
@RestController
@RequestMapping("/user")
public class UserController {

    private IUserService userService = (IUserService) RpcClientProxy.createProxy(IUserService.class);

    @GetMapping("/getById")
    public User getUserById(@RequestParam int id){
        return userService.getById(id);
    }
}
